package org.boulderfoodrescue.webapp.client.googlemap.custominfopanel;

import org.boulderfoodrescue.webapp.client.googlemap.GoogleMap;
import org.boulderfoodrescue.webapp.shared.Location;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;

public class InfoPanel extends Composite{

  private static InfoPanelUiBinder uiBinder = GWT
      .create(InfoPanelUiBinder.class);

  interface InfoPanelUiBinder extends UiBinder<Widget, InfoPanel> {
  }
  @UiField
  Label address_top;
  @UiField
  Label address_bottom;
//  @UiField
//  Label saved_label;
//  @UiField
//  Label edit_button;
//  @UiField
//  FlowPanel options_section;
  protected Location place;
  protected GoogleMap gMap;
  public InfoPanel(Location place, GoogleMap gMap) {
    init(place);
    this.gMap = gMap;
    this.place = place;
//    if(hide_options){
//      options_section.setVisible(false);
//    }

  }
  public void init(Location place){
    initWidget(uiBinder.createAndBindUi(this));
    address_top.setText(place.firstLineOfAddress());
    address_bottom.setText(place.secondLineOfAddress());
//    if(place.getSaved() != 0){
//      Date date = new Date(place.getSaved());
//      saved_label.setText("saved:"+DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT).format(date));
//    }
  }
//  @UiHandler("edit_button")
//  public void onEditClick(ClickEvent e)
//  {
//    EditDialogBox eDialog = new EditDialogBox(place, gMap);
//    eDialog.center();
//  }
}
